package com.usian.controller;


import com.usian.User1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
public class HelloController {

    @Value("${server.port}")
    private String port;//读取8080



    @Autowired
    private User1 user1;

//    @Value("${user1.name1}")
//    private String name2;//读取user
//
//    @Value("${user1.sex}")
//    private Integer sex;//读取user
//
//    @Value("${user1.age}")
//    private Integer age;//读取user
//
//    @Value("${user1.code}")
//    private Integer code;//读取user

    @RequestMapping("hello")

    @ResponseBody
    public String hello(){

        return "hello--------"+port;
    }

    @RequestMapping("getUser")
    public String getUser(Model model){
     /*   User1 user = new User1();
        user.setName1(name2);
        user.setSex(sex);
        user.setAge(age);
        user.setCode(code);*/
        model.addAttribute("user1",user1);
        return "detail";
    }
}
